/**
 * Created by IntelliJ IDEA.
 * User: TsegelskyFamily
 * Date: 31.08.12
 * Time: 14:48
 * To change this template use File | Settings | File Templates.
 */
public class Subset {
    public static void main(String[] args) {
        int k = Integer.parseInt(args[0]);
        RandomizedQueue<String> a = new RandomizedQueue<String>();
        while (!StdIn.isEmpty()) {
            a.enqueue(StdIn.readString());
        }
        for (int i = 0; i < k; i++)
            System.out.println(a.dequeue());
    }
}
